{include file="public/header" /}
<div class="header">
	<a href="{$config['admin_route']}core/menuInfo"><span style="background:#999;">导航列表</span></a>
	<span>按钮列表</span>
	<button type="button" class="layui-btn layui-btn-sm layui-btn-primary" onclick="add({$smid})">
		<i class="layui-icon layui-icon-add-1"></i>添加
	</button>
	<div></div>
</div>
<table class="layui-table">
	<thead>
		<tr>
			<th>排序</th>
			<th>类型</th>
			<th>按钮名</th>
			<th>图标</th>
			<th>状态</th>
			<th>操作</th>
		</tr>
	</thead>
	<tbody>
		{volist name="lists" id='vo'}
			<tr>
				<td>{$vo['sort']}</td>
				<td>
					{if($vo['type']==1)}
						内部链接：{$vo['src']}
					{elseif($vo['type']==2)/}
						超链接：{$vo['src']}
					{/if}
				</td>
				<td>{$vo['label']}</td>
				<td><i class="layui-icon {$vo['icon_class']}"></i> {$vo['icon_class']}</td>
				<td>{$vo['status']==1?'开启':'<span style="color:red;">禁用</span>'}</td>
				<td>
					<button type="button" class="layui-btn layui-btn-xs layui-btn-primary" onclick="edit({$vo.smid})">
						<i class="layui-icon layui-icon-edit"></i>编辑
					</button>
					<button type="button" class="layui-btn layui-btn-xs layui-btn-primary" onclick="del({$vo.smid})">
						<i class="layui-icon layui-icon-delete"></i>删除
					</button>
				</td>
			</tr>
		{/volist}
	</tbody>
</table>
<script type="text/javascript">
	layui.use(['layer'],function(){
		layer = layui.layer;
		$ = layui.jquery;
	});
	// 添加
	function add(smid){
		layer.open({
			type: 2,
			title: '添加按钮',
			shade: 0.3,
			area: ['550px','550px'],
			content: '{$config["admin_route"]}Core/buttonadd?smid='+smid
		});
	}
	// 编辑
	function edit(smid){
		layer.open({
			type: 2,
			title: '编辑按钮',
			shade: 0.3,
			area: ['550px','550px'],
			content: '{$config["admin_route"]}Core/buttonedit?smid='+smid
		});
	}
	// 删除
	function del(smid){
		layer.confirm('确定要删除吗？', {
			icon:3,
			btn: ['确定','取消']
		}, function(){
			$.post('{$config["admin_route"]}core/buttondel',{'smid':smid},function(res){
				if(res.code>0){
					layer.alert(res.msg,{icon:2});
				}else{
					layer.msg(res.msg,{icon:1});
					setTimeout(function(){window.location.reload();},1000);
				}
			},'json');
		});
	}
</script>
{include file="public/tail" /}